#!/bin/sh
# chkconfig: 2345 88 88
# description: dubbo-admin
if [ -f /etc/init.d/functions ]; then
    . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ]; then
    . /etc/rc.d/init.d/functions
else
    echo -e "/atomcat: unable to locate functions lib. Cannot continue."
    exit -1
fi

# 启用环境变量
. /etc/profile

# 服务路径
CATALINA_HOME="${HOME}"

case "$1" in
    start)
        if [ -f ${CATALINA_HOME}/bin/startup.sh ];
            then
            echo $"Starting Tomcat"
            ${CATALINA_HOME}/bin/startup.sh
        fi
    ;;
    stop)
        if [ -f ${CATALINA_HOME}/bin/shutdown.sh ];
            then
            echo $"Stopping Tomcat"
            ${CATALINA_HOME}/bin/shutdown.sh
        fi
    ;;
    *)
        echo $"Usage: $0 {start|stop}"
        exit 1
    ;;
esac

exit $?
